<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="componentsList">
      <el-table-column width="155" label="资产名称" align="center" prop="asset_name" />
      <el-table-column width="155" label="资产标题" align="center" prop="title" />
      <el-table-column width="155" label="资产维护类型" align="center" prop="asset_maintenance_type" />
      <el-table-column width="155" label="开始时间" align="center" prop="start_date" />
      <el-table-column width="155" label="维修周期（天）" align="center" prop="asset_maintenance_time" />
      <el-table-column width="155" label="备注" align="center" prop="notes" />
      <el-table-column width="155" label="维修费用" align="center" prop="cost" />
      <el-table-column width="155" label="供应商" align="center" prop="supplier_name" />
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>

import { listMaintenances } from "@/api/vadmin/assets/assets";

export default {
  name: "Maintain",
  data() {
    return {
      // 资产维护表表格数据
      componentsList: [],
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 50
      },
      total: 0
    };
  },
  created() {
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      listMaintenances(this.queryParams).then(response => {
        this.componentsList = response.data.results;
        this.total = response.data.count;
        this.loading = false;
      });
    }
  }
};
</script>
